import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/home/index.vue'
import Layout from '../layout/index.vue'
import Login from '../views/login/index.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path:'/',
    redirect:"/Login"
  },
  {
    path: '/Login',
    name: 'login',
    component: Login
  },
  {
    path:'/layout',
    name:'layout',
    component:Layout,
    children:[
      {
        path:"home",
        name:'home',
        component:Home
       },{
        path:"cinema",
        name:'cinema',
        component:()=>import('../views/cinema/index.vue')
       },{
        path:"film",
        name:'film',
        component:()=>import('../views/film/index.vue')
       },{
        path:"school",
        name:'school',
        component:()=>import('../views/school/index.vue')
       },{
        path:"user",
        name:'user',
        component:()=>import('../views/user/index.vue')
       },
    ]
  },
  {
    //vue3添加404页面 第一步
    path: '/404',
    name:'notfind',
    component:()=>import('../views/NotFind/NotFind.vue')
}
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
//添加404页面第二步 
router.addRoute({
  path:'/:pathMatch(.*)*',
  redirect:"/404"
})
export default router
